/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('paiflow', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BriefPipelineRun {
  accessibility?: string(name='Accessibility', example='PUBLIC'),
  duration?: long(name='Duration', example='394'),
  finishedAt?: string(name='FinishedAt', example='2021-01-30T12:51:33.028Z'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-30T12:51:33.028Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-30T12:51:33.028Z'),
  message?: string(name='Message', example='error message'),
  name?: string(name='Name', example='testName'),
  nodeId?: string(name='NodeId', example='node-n06d**********fc53'),
  parentUserId?: string(name='ParentUserId', example='155**********904'),
  pipelineId?: string(name='PipelineId', example='pipeline-j94y**********lf7a'),
  pipelineRunId?: string(name='PipelineRunId', example='flow-j94y**********lf7a'),
  sourceId?: string(name='SourceId', example='exp-abcd*********hxfu'),
  sourceType?: string(name='SourceType', example='SDK'),
  startedAt?: string(name='StartedAt', example='2021-01-30T12:51:33.028Z'),
  status?: string(name='Status', example='Succeeded'),
  userId?: string(name='UserId', example='155**********904'),
  workspaceId?: string(name='WorkspaceId', example='1***60'),
}

model FullPipelineRun {
  accessibility?: string(name='Accessibility', example='PUBLIC'),
  arguments?: string(name='Arguments', example='{"arguments":{"parameters":[{"name":"execution","value":{"endpoint":"******","odpsProject":"******"}}]}}'),
  duration?: long(name='Duration', example='394'),
  finishedAt?: string(name='FinishedAt', example='2021-01-30T12:51:33.028Z'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-30T12:51:33.028Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-30T12:51:33.028Z'),
  manifest?: string(name='Manifest', example='{"ApiVersion":"core/v1","Metadata":{"NodeId":"node-n06d**********fc53","Provider":"155**********904","Name":"flow-j94y**********lf7a","Version":"v1","Identifier":"9fe11111-****-****-****-****ec811861","Namespace":null,"DisplayName":"name","NodeType":"Dag"},"Spec":{}}'),
  message?: string(name='Message', example='error message'),
  name?: string(name='Name', example='testName'),
  nodeId?: string(name='NodeId', example='node-n06d**********fc53'),
  options?: string(name='Options', example='{"mlflow":{"experimentId":"exp-**********"}}'),
  parentUserId?: string(name='ParentUserId', example='155**********904'),
  pipelineId?: string(name='PipelineId', example='pipeline-j94y**********lf7a'),
  pipelineRunId?: string(name='PipelineRunId', example='flow-j94y**********lf7a'),
  sourceId?: string(name='SourceId', example='exp-abcd*********hxfu'),
  sourceType?: string(name='SourceType', example='SDK'),
  startedAt?: string(name='StartedAt', example='2021-01-30T12:51:33.028Z'),
  status?: string(name='Status', example='Succeeded'),
  userId?: string(name='UserId', example='155**********904'),
  workspaceId?: string(name='WorkspaceId', example='1***60'),
}

model Node {
  apiVersion?: string(name='ApiVersion', example='core/v1'),
  metadata?: {
    displayName?: string(name='DisplayName', example='test'),
    identifier?: string(name='Identifier', example='composite-pipeline'),
    name?: string(name='Name', example='test'),
    nodeId?: string(name='NodeId', example='node-wcs9z********27ps3'),
    nodeType?: string(name='NodeType', example='Dag'),
    provider?: string(name='Provider', example='15577********904'),
    relatedNodeIds?: [ string ](name='RelatedNodeIds'),
    version?: string(name='Version', example='v1'),
  }(name='Metadata'),
  spec?: {
    dependencies?: [ string ](name='Dependencies'),
    hasPipelines?: boolean(name='HasPipelines', example='true'),
    inputs?: NodeIO(name='Inputs'),
    outputs?: NodeIO(name='Outputs'),
    parallelism?: long(name='Parallelism', example='8'),
    pipelines?: [
      Node
    ](name='Pipelines'),
    when?: string(name='When', example='{{inputs.parameters.parentInput}} == 12'),
    withItems?: [ string ](name='WithItems'),
    withParam?: string(name='WithParam', example='{{pipelines.step1.outputs.parameters.outputparam}}'),
    withSequence?: {
      end?: long(name='End', example='5'),
      format?: string(name='Format', example='test%02X'),
      start?: long(name='Start', example='1'),
    }(name='WithSequence'),
  }(name='Spec'),
  statusInfo?: {
    conditions?: [ 
      {
        status?: string(name='Status', example='True'),
        type?: string(name='Type', example='Completed'),
      }
    ](name='Conditions'),
    finishedAt?: string(name='FinishedAt', example='2021-10-15T10:40:54.000Z'),
    progress?: string(name='Progress', example='9/9'),
    startedAt?: string(name='StartedAt', example='2021-10-15T10:39:58.000Z'),
    status?: string(name='Status', example='Succeeded'),
  }(name='StatusInfo'),
}

model NodeIO {
  artifacts?: [  map[string]any ](name='Artifacts'),
  parameters?: [  map[string]any ](name='Parameters'),
}

model Pipeline {
  gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-21T17:12:35.232Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-21T17:12:35.232Z'),
  identifier?: string(name='Identifier', example='SqlWrite'),
  pipelineId?: string(name='PipelineId', example='pipeline-hynm2bv8**********'),
  provider?: string(name='Provider', example='132668**********'),
  uuid?: string(name='Uuid', example='q8dp9hkl**********'),
  version?: string(name='Version', example='v1'),
  workspaceId?: string(name='WorkspaceId', example='72***'),
}

model Run {
  accessibility?: string(name='Accessibility', example='PUBLIC'),
  duration?: long(name='Duration', example='100'),
  experimentId?: string(name='ExperimentId', example='experiment-ybpy***'),
  finishedAt?: long(name='FinishedAt', example='1638430932100'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-30T12:51:33.028Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-30T12:51:33.028Z'),
  message?: string(name='Message', example='error message'),
  name?: string(name='Name', example='MyName'),
  nodeId?: string(name='NodeId', example='node-sdk**********uhrf'),
  parentUserId?: string(name='ParentUserId', example='155**********904'),
  runId?: string(name='RunId', example='flow-r2b034bh**********'),
  source?: string(name='Source', example='PaiStudio'),
  startedAt?: long(name='StartedAt', example='1638430932001'),
  status?: string(name='Status', example='Running'),
  userId?: string(name='UserId', example='155**********904'),
  workspaceId?: string(name='WorkspaceId', example='78***'),
}

model CreatePipelineRequest {
  manifest?: string(name='Manifest', example='apiVersion: "core/v1"*********'),
  workspaceId?: string(name='WorkspaceId', example='72***'),
}

model CreatePipelineResponseBody = {
  pipelineId?: string(name='PipelineId', example='pipeline-hynm2bv8**********'),
  requestId?: string(name='RequestId', example='DA869D1B-035A-43B2-ACC1-C56681******'),
}

model CreatePipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatePipelineResponseBody(name='body'),
}

async function createPipelineWithOptions(request: CreatePipelineRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePipelineResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.manifest)) {
    body['Manifest'] = request.manifest;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePipeline',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelines`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPipeline(request: CreatePipelineRequest): CreatePipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPipelineWithOptions(request, headers, runtime);
}

model CreatePipelineRunRequest {
  accessibility?: string(name='Accessibility', example='PUBLIC'),
  arguments?: string(name='Arguments', example='arguments:   parameters:   - name: "execution_maxcompute"     value:       endpoint: "http://service***"       odpsProject: "pai***"'),
  name?: string(name='Name', example='testName'),
  noConfirmRequired?: boolean(name='NoConfirmRequired', example='true'),
  options?: string(name='Options', example='{"mlflow":{"experimentId":"exp-1jdk***"}}'),
  pipelineId?: string(name='PipelineId', example='flow-rer7y***'),
  pipelineManifest?: string(name='PipelineManifest', example='apiVersion: "core/v1"*********'),
  sourceId?: string(name='SourceId', example='experiment-ybpy***'),
  sourceType?: string(name='SourceType', example='UNKNOWN'),
  workspaceId?: string(name='WorkspaceId', example='84***'),
}

model CreatePipelineRunResponseBody = {
  pipelineRunId?: string(name='PipelineRunId', example='flow-rbvg***'),
  requestId?: string(name='RequestId', example='DA869D1B-035A-43B2-ACC1-C56681BD9FAA'),
}

model CreatePipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreatePipelineRunResponseBody(name='body'),
}

async function createPipelineRunWithOptions(request: CreatePipelineRunRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePipelineRunResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accessibility)) {
    body['Accessibility'] = request.accessibility;
  }
  if (!Util.isUnset(request.arguments)) {
    body['Arguments'] = request.arguments;
  }
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }
  if (!Util.isUnset(request.noConfirmRequired)) {
    body['NoConfirmRequired'] = request.noConfirmRequired;
  }
  if (!Util.isUnset(request.options)) {
    body['Options'] = request.options;
  }
  if (!Util.isUnset(request.pipelineId)) {
    body['PipelineId'] = request.pipelineId;
  }
  if (!Util.isUnset(request.pipelineManifest)) {
    body['PipelineManifest'] = request.pipelineManifest;
  }
  if (!Util.isUnset(request.sourceId)) {
    body['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.sourceType)) {
    body['SourceType'] = request.sourceType;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreatePipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createPipelineRun(request: CreatePipelineRunRequest): CreatePipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createPipelineRunWithOptions(request, headers, runtime);
}

model DeletePipelineResponseBody = {
  requestId?: string(name='RequestId', example='DA869D1B-035A-43B2-ACC1-C56681BD9FAA'),
}

model DeletePipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePipelineResponseBody(name='body'),
}

async function deletePipelineWithOptions(PipelineId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeletePipelineResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeletePipeline',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelines/${OpenApiUtil.getEncodeParam(PipelineId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePipeline(PipelineId: string): DeletePipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deletePipelineWithOptions(PipelineId, headers, runtime);
}

model DeletePipelineRunResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
}

model DeletePipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeletePipelineRunResponseBody(name='body'),
}

async function deletePipelineRunWithOptions(PipelineRunId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeletePipelineRunResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeletePipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deletePipelineRun(PipelineRunId: string): DeletePipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deletePipelineRunWithOptions(PipelineRunId, headers, runtime);
}

model GetPipelineResponseBody = {
  gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-21T17:12:35.232Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-21T17:12:35.232Z'),
  identifier?: string(name='Identifier', example='SqlWrite'),
  manifest?: string(name='Manifest', example='apiVersion: ****'),
  pipelineId?: string(name='PipelineId', example='pipeline-hynm2bv8wqhp5e****'),
  provider?: string(name='Provider', example='132668941337****'),
  requestId?: string(name='RequestId', example='63EDFF2F-4D51-46F0-9D65-2F8F393B****'),
  uuid?: string(name='Uuid', example='q8dp9hklueznhg****'),
  version?: string(name='Version', example='v1'),
  workspaceId?: string(name='WorkspaceId', example='726**'),
}

model GetPipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPipelineResponseBody(name='body'),
}

async function getPipelineWithOptions(PipelineId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPipelineResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetPipeline',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelines/${OpenApiUtil.getEncodeParam(PipelineId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPipeline(PipelineId: string): GetPipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPipelineWithOptions(PipelineId, headers, runtime);
}

model GetPipelineRunRequest {
  manifestType?: string(name='ManifestType', example='Raw'),
  tokenId?: string(name='TokenId'),
  verbose?: boolean(name='Verbose', example='false'),
}

model GetPipelineRunResponseBody = {
  accessibility?: string(name='Accessibility', example='PUBLIC'),
  arguments?: string(name='Arguments', example='{"arguments":{"parameters":[{"name":"execution","value":{"endpoint":"http://service.******","odpsProject":"******","spec":{"endpoint":"http://service.******","odpsProject":"*****"},"resourceType":"MaxCompute"}}]}}'),
  duration?: long(name='Duration', example='60'),
  finishedAt?: string(name='FinishedAt', example='2021-01-30T12:52:33.028Z'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-30T12:51:33.028Z'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-30T12:51:33.028Z'),
  manifest?: string(name='Manifest', example='{"ApiVersion":"core/v1","Metadata":{"NodeId":"node-n06d**********fc53","Provider":"155**********904","Name":"flow-j94y**********lf7a","Version":"v1","Identifier":"9fe11111-****-****-****-****ec811861","Namespace":null,"DisplayName":"name","NodeType":"Dag"},"Spec":{}}'),
  message?: string(name='Message', example='error message'),
  name?: string(name='Name', example='testName'),
  nodeId?: string(name='NodeId', example='node-n06d**********fc53'),
  options?: string(name='Options', example='{"mlflow":{"experimentId":"exp-**********"}}'),
  parentUserId?: string(name='ParentUserId', example='155**********904'),
  pipelineId?: string(name='PipelineId', example='pipeline-j94y**********lf7a'),
  pipelineRunId?: string(name='PipelineRunId', example='flow-j94y**********lf7a'),
  pipelineRunUri?: string(name='PipelineRunUri'),
  requestId?: string(name='RequestId', example='DA869D1B-035A-43B2-ACC1-C56681BD9FAA'),
  sourceId?: string(name='SourceId', example='abcd*********hxfu'),
  sourceType?: string(name='SourceType', example='UNKNOWN'),
  startedAt?: string(name='StartedAt', example='2021-01-30T12:51:33.028Z'),
  status?: string(name='Status', example='Succeeded'),
  userId?: string(name='UserId', example='155**********904'),
  workspaceId?: string(name='WorkspaceId', example='15945'),
}

model GetPipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPipelineRunResponseBody(name='body'),
}

async function getPipelineRunWithOptions(PipelineRunId: string, request: GetPipelineRunRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetPipelineRunResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.manifestType)) {
    query['ManifestType'] = request.manifestType;
  }
  if (!Util.isUnset(request.tokenId)) {
    query['TokenId'] = request.tokenId;
  }
  if (!Util.isUnset(request.verbose)) {
    query['Verbose'] = request.verbose;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPipelineRun(PipelineRunId: string, request: GetPipelineRunRequest): GetPipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPipelineRunWithOptions(PipelineRunId, request, headers, runtime);
}

model GetPipelineRunNodeRequest {
  depth?: int32(name='Depth', example='2'),
  tokenId?: string(name='TokenId'),
  type?: string(name='Type', example='Logical'),
}

model GetPipelineRunNodeResponseBody = {
  apiVersion?: string(name='ApiVersion', example='core/v1'),
  metadata?: {
    displayName?: string(name='DisplayName', example='flow-ebppc********5lwea'),
    identifier?: string(name='Identifier', example='composite-pipeline'),
    name?: string(name='Name', example='flow-ebppc********5lwea'),
    nodeId?: string(name='NodeId', example='node-wcs9z********27ps3'),
    nodeType?: string(name='NodeType', example='Dag'),
    provider?: string(name='Provider', example='15577********904'),
    relatedNodeIds?: [ string ](name='RelatedNodeIds'),
    version?: string(name='Version', example='v1'),
  }(name='Metadata'),
  requestId?: string(name='RequestId', example='0a981ea816**********42244e7ba2'),
  spec?: {
    dependencies?: [ string ](name='Dependencies'),
    hasPipelines?: boolean(name='HasPipelines', example='true'),
    inputs?: {
      artifacts?: [  map[string]any ](name='Artifacts'),
      parameters?: [  map[string]any ](name='Parameters'),
    }(name='Inputs'),
    outputs?: {
      artifacts?: [  map[string]any ](name='Artifacts'),
      parameters?: [  map[string]any ](name='Parameters'),
    }(name='Outputs'),
    parallelism?: int32(name='Parallelism', example='2'),
    pipelines?: [  map[string]any ](name='Pipelines'),
    when?: string(name='When', example='”{{inputs.parameters.skip}} == false“'),
    withItems?: [ string ](name='WithItems'),
    withParam?: string(name='WithParam', example='"{{pipelines.generate.outputs.result}}"'),
    withSequence?: {
      end?: int32(name='End', example='10'),
      format?: string(name='Format', example='"2020-05-%d"'),
      start?: int32(name='Start', example='1'),
    }(name='WithSequence'),
  }(name='Spec'),
  statusInfo?: {
    conditions?: [  map[string]any ](name='Conditions'),
    finishedAt?: string(name='FinishedAt', example='2021-10-15T10:40:54.000Z'),
    progress?: string(name='Progress', example='9/9'),
    startedAt?: string(name='StartedAt', example='2021-10-15T10:39:58.000Z'),
    status?: string(name='Status', example='Succeeded'),
  }(name='StatusInfo'),
}

model GetPipelineRunNodeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPipelineRunNodeResponseBody(name='body'),
}

async function getPipelineRunNodeWithOptions(PipelineRunId: string, NodeId: string, request: GetPipelineRunNodeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetPipelineRunNodeResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.depth)) {
    query['Depth'] = request.depth;
  }
  if (!Util.isUnset(request.tokenId)) {
    query['TokenId'] = request.tokenId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetPipelineRunNode',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/nodes/${OpenApiUtil.getEncodeParam(NodeId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPipelineRunNode(PipelineRunId: string, NodeId: string, request: GetPipelineRunNodeRequest): GetPipelineRunNodeResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getPipelineRunNodeWithOptions(PipelineRunId, NodeId, request, headers, runtime);
}

model ListPipelineRunNodeLogsRequest {
  fromTimeInSeconds?: long(name='FromTimeInSeconds', example='1612180056'),
  keyword?: string(name='Keyword', example='abc'),
  offset?: int32(name='Offset', example='0'),
  pageSize?: int32(name='PageSize', example='100'),
  reverse?: boolean(name='Reverse', example='false'),
  toTimeInSeconds?: long(name='ToTimeInSeconds', example='1612180056'),
  tokenId?: string(name='TokenId'),
}

model ListPipelineRunNodeLogsResponseBody = {
  logs?: [ string ](name='Logs'),
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount', example='10'),
}

model ListPipelineRunNodeLogsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPipelineRunNodeLogsResponseBody(name='body'),
}

async function listPipelineRunNodeLogsWithOptions(PipelineRunId: string, NodeId: string, request: ListPipelineRunNodeLogsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelineRunNodeLogsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.fromTimeInSeconds)) {
    query['FromTimeInSeconds'] = request.fromTimeInSeconds;
  }
  if (!Util.isUnset(request.keyword)) {
    query['Keyword'] = request.keyword;
  }
  if (!Util.isUnset(request.offset)) {
    query['Offset'] = request.offset;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.reverse)) {
    query['Reverse'] = request.reverse;
  }
  if (!Util.isUnset(request.toTimeInSeconds)) {
    query['ToTimeInSeconds'] = request.toTimeInSeconds;
  }
  if (!Util.isUnset(request.tokenId)) {
    query['TokenId'] = request.tokenId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelineRunNodeLogs',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/nodes/${OpenApiUtil.getEncodeParam(NodeId)}/logs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPipelineRunNodeLogs(PipelineRunId: string, NodeId: string, request: ListPipelineRunNodeLogsRequest): ListPipelineRunNodeLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelineRunNodeLogsWithOptions(PipelineRunId, NodeId, request, headers, runtime);
}

model ListPipelineRunNodeOutputsRequest {
  depth?: int32(name='Depth', example='2'),
  name?: string(name='Name', example='myName'),
  order?: string(name='Order', example='DESC'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  sortBy?: string(name='SortBy', example='GmtCreateTime'),
  tokenId?: string(name='TokenId'),
  type?: string(name='Type', example='DataSet'),
}

model ListPipelineRunNodeOutputsResponseBody = {
  outputs?: [ 
    {
      expandableArtifactName?: string(name='ExpandableArtifactName', example='inputArtifact'),
      expandedArtifactIndex?: long(name='ExpandedArtifactIndex', example='0'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-30T12:51:33.028Z'),
      id?: string(name='Id', example='artifact-ty1xwv*******s8zf'),
      info?: map[string]any(name='Info', example='{         "metadata": {           "type": {             "Model": {               "locationType": "MaxComputeOfflineModel",               "modelType": "OfflineModel"             }           }         }'),
      name?: string(name='Name', example='model_******'),
      nodeId?: string(name='NodeId', example='node-obpzu*******418grb7'),
      producer?: string(name='Producer', example='id-3d25-************-77856'),
      type?: string(name='Type', example='Model'),
    }
  ](name='Outputs'),
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount', example='2'),
}

model ListPipelineRunNodeOutputsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPipelineRunNodeOutputsResponseBody(name='body'),
}

async function listPipelineRunNodeOutputsWithOptions(PipelineRunId: string, NodeId: string, request: ListPipelineRunNodeOutputsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelineRunNodeOutputsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.depth)) {
    query['Depth'] = request.depth;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.tokenId)) {
    query['TokenId'] = request.tokenId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelineRunNodeOutputs',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/nodes/${OpenApiUtil.getEncodeParam(NodeId)}/outputs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPipelineRunNodeOutputs(PipelineRunId: string, NodeId: string, request: ListPipelineRunNodeOutputsRequest): ListPipelineRunNodeOutputsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelineRunNodeOutputsWithOptions(PipelineRunId, NodeId, request, headers, runtime);
}

model ListPipelineRunNodeStatusRequest {
  depth?: long(name='Depth', example='2'),
  tokenId?: string(name='TokenId'),
  type?: string(name='Type', example='Logical'),
}

model ListPipelineRunNodeStatusResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
  status?: [ 
    {
      finishedAt?: string(name='FinishedAt', example='2021-01-21T17:12:40.232Z'),
      nodeId?: string(name='NodeId', example='node-1jlzg7ncv0j6i3****'),
      nodeName?: string(name='NodeName', example='sql'),
      runtimeInfo?: string(name='RuntimeInfo', example='{\\"DLC_INSTANCE_IDS\\": \\"i-12224afdfsaf,i-22224afdfsaf,i-13224afdfsaf\\"}'),
      startedAt?: string(name='StartedAt', example='2021-01-21T17:12:35.232Z'),
      status?: string(name='Status', example='Succeeded'),
    }
  ](name='Status'),
}

model ListPipelineRunNodeStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPipelineRunNodeStatusResponseBody(name='body'),
}

async function listPipelineRunNodeStatusWithOptions(PipelineRunId: string, NodeId: string, request: ListPipelineRunNodeStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelineRunNodeStatusResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.depth)) {
    query['Depth'] = request.depth;
  }
  if (!Util.isUnset(request.tokenId)) {
    query['TokenId'] = request.tokenId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelineRunNodeStatus',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/nodes/${OpenApiUtil.getEncodeParam(NodeId)}/status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPipelineRunNodeStatus(PipelineRunId: string, NodeId: string, request: ListPipelineRunNodeStatusRequest): ListPipelineRunNodeStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelineRunNodeStatusWithOptions(PipelineRunId, NodeId, request, headers, runtime);
}

model ListPipelineRunsRequest {
  name?: string(name='Name', example='testName'),
  order?: string(name='Order', example='DESC'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  pipelineIds?: string(name='PipelineIds', example='flow-rer7**********0otv, flow-hynm**********sfef'),
  pipelineRunId?: string(name='PipelineRunId'),
  sortBy?: string(name='SortBy', example='PipelineId'),
  sourceId?: string(name='SourceId', example='ybpy**********fb2z'),
  sourceType?: string(name='SourceType', example='UNKNOWN'),
  status?: string(name='Status', example='Succeeded'),
  userId?: string(name='UserId', example='155**********904'),
  workspaceId?: string(name='WorkspaceId', example='104623'),
}

model ListPipelineRunsResponseBody = {
  pipelineRuns?: [ 
    {
      accessibility?: string(name='Accessibility', example='PUBLIC'),
      duration?: int32(name='Duration', example='60'),
      finishedAt?: string(name='FinishedAt', example='2021-01-30T12:52:33.028Z'),
      gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-30T12:51:33.028Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-30T12:51:33.028Z'),
      message?: string(name='Message', example='error message'),
      name?: string(name='Name', example='testName'),
      nodeId?: string(name='NodeId', example='node-n06d**********fc53'),
      parentUserId?: string(name='ParentUserId', example='155**********904'),
      pipelineId?: string(name='PipelineId', example='pipeline-j94y**********lf7a'),
      pipelineRunId?: string(name='PipelineRunId', example='flow-j94y**********lf7a'),
      pipelineRunUri?: string(name='PipelineRunUri'),
      sourceId?: string(name='SourceId', example='abcd*********hxfu'),
      sourceType?: string(name='SourceType', example='UNKNOWN'),
      startedAt?: string(name='StartedAt', example='2021-01-30T12:51:33.028Z'),
      status?: string(name='Status', example='Succeeded'),
      userId?: string(name='UserId', example='155**********904'),
      workspaceId?: string(name='WorkspaceId', example='15945'),
    }
  ](name='PipelineRuns'),
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
  totalCount?: long(name='TotalCount', example='15'),
}

model ListPipelineRunsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPipelineRunsResponseBody(name='body'),
}

async function listPipelineRunsWithOptions(request: ListPipelineRunsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelineRunsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.order)) {
    query['Order'] = request.order;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pipelineIds)) {
    query['PipelineIds'] = request.pipelineIds;
  }
  if (!Util.isUnset(request.pipelineRunId)) {
    query['PipelineRunId'] = request.pipelineRunId;
  }
  if (!Util.isUnset(request.sortBy)) {
    query['SortBy'] = request.sortBy;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.sourceType)) {
    query['SourceType'] = request.sourceType;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelineRuns',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPipelineRuns(request: ListPipelineRunsRequest): ListPipelineRunsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelineRunsWithOptions(request, headers, runtime);
}

model ListPipelineRunsStatusRequest {
  nodes?: [ 
    {
      nodeId?: string(name='NodeId', example='node-hynm2bv8wqhp5esfx1'),
      pipelineRunId?: string(name='PipelineRunId', example='flow-hynm2bv8wqhp5esfxq'),
    }
  ](name='Nodes'),
  outputType?: string(name='OutputType'),
  pipelineRuns?: [ string ](name='PipelineRuns'),
  workspaceId?: string(name='WorkspaceId', example='948**'),
}

model ListPipelineRunsStatusResponseBody = {
  nodes?: [ 
    {
      finishedAt?: string(name='FinishedAt', example='2021-01-21T17:12:35.232Z'),
      inputArtifactArchived?: boolean(name='InputArtifactArchived', example='true'),
      nodeId?: string(name='NodeId', example='node-hynm2bv8wqhp5esfx1'),
      nodeName?: string(name='NodeName', example='dataSource'),
      outputArtifactArchived?: boolean(name='OutputArtifactArchived', example='true'),
      pipelineRunId?: string(name='PipelineRunId', example='flow-hynm2bv8wqhp5esfxq'),
      startedAt?: string(name='StartedAt', example='2021-01-21T17:12:35.232Z'),
      status?: string(name='Status', example='Running'),
    }
  ](name='Nodes'),
  outputs?: [ 
    {
      expandableArtifactName?: string(name='ExpandableArtifactName'),
      expandedArtifactIndex?: int32(name='ExpandedArtifactIndex'),
      gmtCreateTime?: string(name='GmtCreateTime'),
      id?: string(name='Id'),
      metadata?: map[string]any(name='Metadata'),
      name?: string(name='Name'),
      nodeId?: string(name='NodeId'),
      pipelineRunId?: string(name='PipelineRunId'),
      producer?: string(name='Producer'),
      type?: string(name='Type'),
      value?: string(name='Value'),
    }
  ](name='Outputs'),
  pipelineRuns?: [ 
    {
      isDeleted?: boolean(name='IsDeleted', example='false'),
      name?: string(name='Name', example='myName'),
      nodeId?: string(name='NodeId', example='node-98odqfpcjzwdf3caq3'),
      parentUserId?: string(name='ParentUserId', example='1557702098194904'),
      pipelineRunId?: string(name='PipelineRunId', example='flow-hynm2bv8wqhp5esfxq'),
      sourceId?: string(name='SourceId', example='lmi7d24h3kr0xczjlu'),
      status?: string(name='Status', example='Running'),
      userId?: string(name='UserId', example='1557702098194904'),
    }
  ](name='PipelineRuns'),
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
}

model ListPipelineRunsStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPipelineRunsStatusResponseBody(name='body'),
}

async function listPipelineRunsStatusWithOptions(request: ListPipelineRunsStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelineRunsStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.nodes)) {
    body['Nodes'] = request.nodes;
  }
  if (!Util.isUnset(request.outputType)) {
    body['OutputType'] = request.outputType;
  }
  if (!Util.isUnset(request.pipelineRuns)) {
    body['PipelineRuns'] = request.pipelineRuns;
  }
  if (!Util.isUnset(request.workspaceId)) {
    body['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelineRunsStatus',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPipelineRunsStatus(request: ListPipelineRunsStatusRequest): ListPipelineRunsStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelineRunsStatusWithOptions(request, headers, runtime);
}

model ListPipelinesRequest {
  fuzzyMatching?: boolean(name='FuzzyMatching', example='false'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  pipelineIdentifier?: string(name='PipelineIdentifier', example='SqlWriteTable_2'),
  pipelineProvider?: string(name='PipelineProvider', example='pai'),
  pipelineVersion?: string(name='PipelineVersion', example='v1'),
  workspaceId?: string(name='WorkspaceId', example='726**'),
}

model ListPipelinesResponseBody = {
  pipelines?: [ 
    {
      gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-06T14:32:50Z'),
      gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-06T22:26:24Z'),
      identifier?: string(name='Identifier', example='SqlWriteTable_2'),
      pipelineId?: string(name='PipelineId', example='pipeline-c0h44g3wlwkj8o*****'),
      provider?: string(name='Provider', example='pai'),
      uuid?: string(name='Uuid', example='q8dp9hklueznh*****'),
      version?: string(name='Version', example='v1'),
      workspaceId?: string(name='WorkspaceId', example='726**'),
    }
  ](name='Pipelines'),
  requestId?: string(name='RequestId', example='DA869D1B-035A-43B2-ACC1-C56681B****'),
  totalCount?: long(name='TotalCount', example='15'),
}

model ListPipelinesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListPipelinesResponseBody(name='body'),
}

async function listPipelinesWithOptions(request: ListPipelinesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPipelinesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.fuzzyMatching)) {
    query['FuzzyMatching'] = request.fuzzyMatching;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pipelineIdentifier)) {
    query['PipelineIdentifier'] = request.pipelineIdentifier;
  }
  if (!Util.isUnset(request.pipelineProvider)) {
    query['PipelineProvider'] = request.pipelineProvider;
  }
  if (!Util.isUnset(request.pipelineVersion)) {
    query['PipelineVersion'] = request.pipelineVersion;
  }
  if (!Util.isUnset(request.workspaceId)) {
    query['WorkspaceId'] = request.workspaceId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPipelines',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelines`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listPipelines(request: ListPipelinesRequest): ListPipelinesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPipelinesWithOptions(request, headers, runtime);
}

model RerunPipelineRunResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request', example='DA869D1B-035A-43B2-ACC1-C56681BD9FAA'),
}

model RerunPipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RerunPipelineRunResponseBody(name='body'),
}

async function rerunPipelineRunWithOptions(PipelineRunId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RerunPipelineRunResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RerunPipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/rerun`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function rerunPipelineRun(PipelineRunId: string): RerunPipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return rerunPipelineRunWithOptions(PipelineRunId, headers, runtime);
}

model StartPipelineRunResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
}

model StartPipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartPipelineRunResponseBody(name='body'),
}

async function startPipelineRunWithOptions(PipelineRunId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StartPipelineRunResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StartPipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/start`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startPipelineRun(PipelineRunId: string): StartPipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return startPipelineRunWithOptions(PipelineRunId, headers, runtime);
}

model TerminatePipelineRunResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
}

model TerminatePipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TerminatePipelineRunResponseBody(name='body'),
}

async function terminatePipelineRunWithOptions(PipelineRunId: string, headers: map[string]string, runtime: Util.RuntimeOptions): TerminatePipelineRunResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'TerminatePipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}/termination`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function terminatePipelineRun(PipelineRunId: string): TerminatePipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return terminatePipelineRunWithOptions(PipelineRunId, headers, runtime);
}

model UpdatePipelineRequest {
  manifest?: string(name='Manifest', example='apiVersion: "core/v1"*********'),
}

model UpdatePipelineResponseBody = {
  requestId?: string(name='RequestId', example='DA869D1B-035A-43B2-ACC1-C56681******'),
}

model UpdatePipelineResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdatePipelineResponseBody(name='body'),
}

async function updatePipelineWithOptions(PipelineId: string, request: UpdatePipelineRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdatePipelineResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.manifest)) {
    body['Manifest'] = request.manifest;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdatePipeline',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelines/${OpenApiUtil.getEncodeParam(PipelineId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updatePipeline(PipelineId: string, request: UpdatePipelineRequest): UpdatePipelineResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updatePipelineWithOptions(PipelineId, request, headers, runtime);
}

model UpdatePipelineRunRequest {
  name?: string(name='Name', example='testName'),
}

model UpdatePipelineRunResponseBody = {
  requestId?: string(name='RequestId', example='473469C7-****-****-****-A3DC0DE3C83E'),
}

model UpdatePipelineRunResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdatePipelineRunResponseBody(name='body'),
}

async function updatePipelineRunWithOptions(PipelineRunId: string, request: UpdatePipelineRunRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdatePipelineRunResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.name)) {
    body['Name'] = request.name;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdatePipelineRun',
    version = '2021-02-02',
    protocol = 'HTTPS',
    pathname = `/api/v1/pipelineruns/${OpenApiUtil.getEncodeParam(PipelineRunId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updatePipelineRun(PipelineRunId: string, request: UpdatePipelineRunRequest): UpdatePipelineRunResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updatePipelineRunWithOptions(PipelineRunId, request, headers, runtime);
}

